/* GUI CONVERTED from rccupu2.p (converter v1.75) Tue Apr 10 12:04:11 2001 */
/* rccupu2.p - CUSTOMER SCHEDULES - CREATE TR_HIST IN SHIPFROM DB             */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.4.2.4 $                                                        */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.3    LAST MODIFIED: 08/25/95           BY: bcm *G0TB*          */
/* REVISION: 8.5    LAST MODIFIED: 09/26/97     BY: *J21M* Suresh Nayak       */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98     BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6    LAST MODIFIED: 11/25/99     BY: *J3MR* Manish Kulkarni    */
/* REVISION: 9.1    LAST MODIFIED: 11/03/99     BY: *N05R* B. Gates           */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00     BY: *N0KP* myb                */
/* $Revision: 1.4.2.4 $    BY: Jean Miller    DATE: 03/22/01 ECO: *P008*          */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* CUM SHIP ADJUSTMENT UPDATE SHIP-FROM DATABASE tr_hist RECORDS */

{mfdeclre.i}

define input parameter     sod-nbr           like sod_nbr.
define input parameter     sod-line          like sod_line.
define input parameter     remarks           as character format "x(24)".
define input parameter     cust              like so_cust.
define input parameter     cum-ship-start-dt as date.

define input parameter    l_int_time as integer no-undo.
define input parameter    l_new_cum_qty like sod_cum_qty[1] no-undo.

define       buffer        soddet       for sod_det.

/*! FIND THE SO DETAIL RECORD */
find sod_det where
     sod_nbr  = sod-nbr and
     sod_line = sod-line
exclusive-lock.

/* CREATE AND UPDATE TRANSACTION HISTORY */
create tr_hist.
assign
   tr_date      = today
   tr_effdate   = today
   tr_part      = sod_part
   tr_type      = "CUM-SRES"
   tr_nbr       = sod_nbr
   tr_line      = sod_line
   tr_so_job    = sod_nbr
   tr_addr      = cust
   tr_program   = execname
   tr_time      = time
   tr_loc_begin = l_new_cum_qty
   tr_rmks      = remarks
   tr_userid    = global_userid
   tr_qty_chg   = l_new_cum_qty - sod_cum_qty[1].

/* ASSIGN TRANSACTION NUMBER TO TR_HIST */
{mfntran.i}

/* UPDATE SOD_DET */
do for soddet:
   find soddet where recid(soddet) = recid(sod_det) exclusive-lock.
   assign
      sod_cum_qty[1] = l_new_cum_qty
      sod_cum_date[1] = cum-ship-start-dt
      sod_cum_time[1] = l_int_time.
end.
